<?Lassoscript
// Define Heirarchy Labels Map
// Usage: This is not a custom tag, but should be called at the top of each
// page that wants access to the Heirarchy labels
// Then, when you want to output the label, do this:
//    Var('ThisHeirarchyLabel' = ($HeirarchyLabels->(Find:'1')) where the Find:'1' would be the value
//    of the UserPrivs_PrivID in the Users table
// So, a typical usage would be this:
 
// This hack saves the debug status, then we turn it off until restored
Var('DebugStatus' = $svDebug);
Var('svDebug' = 'N');

// Privs Map
Var('HeirarchyLabels' = map);

Var('SQLGetHeirarchies' = ('SELECT ID, name
	FROM '+($svSiteDatabase)+'.'+($svHeirarchyTable)));
Inline($gv_sql, -SQL=$SQLGetHeirarchies, -MaxRecords='All');
	Records;
		$HeirarchyLabels->insert((Field('id')) = (Field('name')));
//			('15: ID = '+(Field('ID')+'<br>\n');
//			('15: name = '+(Field('name')+'<br>\n');
	/Records;
/Inline;

// Restore debugging
Var('svDebug' = $DebugStatus);

If($svDebug == 'Y');
	('<p class="debug"><strong>get_HeirarchyLabels.inc</strong><br>\n');
	('25: HeirarchyLabels = '+($HeirarchyLabels)+'<br>\n');
	Var('ThisHeirarchyLabel' = ($HeirarchyLabels->(Find:'1')));
	('25: ThisHeirarchyLabel = '+($ThisHeirarchyLabel)+'</p>\n');
/If;


?>
